package com.longrise.android.byjk.plugins.request;

import android.os.Bundle;

import com.longrise.LEAP.Base.Objects.EntityBean;
import com.longrise.android.byjk.model.UserInfor;

/**
 * Created by sujizhong on 2016/12/26.
 */

public class CurriculumRequest extends AppBaseRequest {

    private static final String TAG = "CurriculumRequest";

    private AppBaseResult mResult;
    private String mApi;

    public CurriculumRequest() {
    }

    public CurriculumRequest(AppBaseResult result) {
        this.mResult = result;
    }

    /**
     * 获取请求实体 默认必须重写该方法
     * 接口中存在附加参数需要在Activity中传递，此时请复写 getRequestParams(Bundle extraParams) 该方法
     * 如果仅从API无法区分接口操作时(同一个接口修改不同数据时)，此时请复写 getRequestParams(int tag, Bundle extraParams) 该方法
     */
    @Override
    public Object getRequestParams() {
        return null;
    }

    @Override
    public Object getRequestParams(int tag, Bundle extraParams) {
        EntityBean bean = new EntityBean();
        bean.set("cardno", UserInfor.getInstance().getUsersfzh());
        bean.set("planid", extraParams.getString("planid"));
        bean.set("studentno", extraParams.getString("studentno"));
        switch (mApi) {
            case "bbt_course_sTrainCertImg":     //培训证书 共用请求结构体
                break;

            case "bbt_course_sTrainRecordImg":   //培训记录表
                break;

            case "bbt_course_resumtraininfo":
                bean.set("signupid", extraParams.getString("signupid"));
                break;

            default:
                break;
        }

        EntityBean reqBean = new EntityBean();
        reqBean.set("bean", bean);
        return reqBean;
    }

    /**
     * @return setResult(AppBaseResult result)中的参数
     */
    @Override
    public AppBaseResult getResult() {
        return mResult;
    }

    /**
     * @param result 回调 必须要设置该result,否则无法获知请求结果
     *               设置回调解析
     */
    @Override
    public void setResult(AppBaseResult result) {
        this.mResult = result;

    }

    /**
     * @return setApi(String api)中参数
     */
    @Override
    public String getApi() {
        return mApi;
    }

    /**
     * @param api 请求api  必须设置该请求api，否则无法访问服务
     *            设置当前请求的api
     */
    @Override
    public void setApi(String api) {
        mApi = api;
    }
}
